//将请求封装成对象
class Command
{
public:
	virtual void execute() = 0;
};

class ConcreteCommand1:public Command
{
	string arg;
public:
	ConcreteCommand1(const string& a):arg(a){}
	void execute() override
	{
		cout << "#1 process ..." << arg << endl;
	}
}

class ConcreteCommand2:public Command
{
	string arg;
public:
	ConcreteCommand2(const string& a):arg(a){}
	void execute() override
	{
		cout << "#2 process ..." << arg << endl;
	}
};

class MacroCommand:public Command
{
	std::vector<Command*> commands;
public:
	void addCommand(Command* c){command.push_back(c);}
	void execute() override
	{
		for(auto& c:command)
		{
			c->execute();
		}
	}
};

int main()
{
	ConcreteCommand1 cm1(receiver,"Arg1");
	ConcreteCommand2 cm2(receiver,"Arg1");
	MacroCommand macro;
	macro.addCommand(&command1);
	macro.addCommand(&command2);
	macro.execute();
}